<template>
  <img :src="imgSrc" alt="">
</template>

<script setup lang="ts">
import request from "@/request";
import {onMounted, ref} from "vue";

const imgSrc = ref('');
onMounted(() => {
  request.get("/commonEntity/generateImageCode", {
    responseType: "arraybuffer",
  }).then((res:any) => {
    const bufferUrl = btoa(
        new Uint8Array(res).reduce(
            (data, byte) => data + String.fromCharCode(byte),
            ""
        )
    );
    imgSrc.value = "data:image/png;base64," + bufferUrl;
  })
})

</script>
